
package cn.org.seventh.web.tag;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager;

/**
 * @author <a href="mailto:ji.li@symbio-group.com">Andy</a>
 * @since Dec 3, 2007 10:55:00 AM
 * @jsp.tag name="fck" description="the fckeditor tag" body-content="JSP"
 */
public class FCKEditorTag extends BodyTagSupport {

    /**
     * 
     */
    private static final long serialVersionUID = 3805158612947132469L;

    private String uuid;

    private String id;

    private String value = "";

    private String basePath = null;

    private String toolbarSet = null;

    private String width = null;

    private String height = null;

    private String customConfigurationsPath = null;

    private String editorAreaCSS = null;

    private String baseHref = null;

    private String skinPath = null;

    private String pluginsPath = null;

    private String fullPage = null;

    private String debug = null;

    private String autoDetectLanguage = null;

    private String defaultLanguage = null;

    private String contentLangDirection = null;

    private String enableXHTML = null;

    private String enableSourceXHTML = null;

    private String fillEmptyBlocks = null;

    private String formatSource = null;

    private String formatOutput = null;

    private String formatIndentator = null;

    private String geckoUseSPAN = null;

    private String startupFocus = null;

    private String forcePasteAsPlainText = null;

    private String forceSimpleAmpersand = null;

    private String tabSpaces = null;

    private String useBROnCarriageReturn = null;

    private String toolbarStartExpanded = null;

    private String toolbarCanCollapse = null;

    private String fontColors = null;

    private String fontNames = null;

    private String fontSizes = null;

    private String fontFormats = null;

    private String stylesXmlPath = null;

    private String linkBrowserURL = null;

    private String imageBrowserURL = null;

    private String flashBrowserURL = null;

    private String linkUploadURL = null;

    private String imageUploadURL = null;

    private String flashUploadURL = null;

    private String enableImageBrowser;

    private String enableLinkBrowser;

    private String enableFlashBrowser;

    private String enableLinkUpload;

    private String enableImageUpload;

    private String enableFlashUpload;

    /**
     * The underlying FCKEditor object
     */
    protected FCKEditor fcked = null;

    /**
     * @jsp.attribute required="true" rtexprvalue="true" Set the unique id of
     *                the editor
     * @param value
     *            name
     */
    public void setId(String value) {
        // id = value;
        try {
            this.id =
                (String) ExpressionEvaluatorManager.evaluate("id", value,
                    String.class, this, pageContext);
        } catch (JspException e) {
            e.printStackTrace();
        }
    }

    /**
     * @jsp.attribute required="true" rtexprvalue="true" Set the dir where the
     *                FCKEditor files reside on the server
     * @param value
     *            path
     */
    public void setBasePath(String value) {
        // basePath = value;
        try {
            this.basePath =
                (String) ExpressionEvaluatorManager.evaluate("basePath", value,
                    String.class, this, pageContext);
        } catch (JspException e) {
            e.printStackTrace();
        }
    }

    /**
     * @jsp.attribute required="true" rtexprvalue="true" Set the name of the
     *                toolbar to display
     * @param value
     *            toolbar name
     */
    public void setToolbarSet(String value) {
        toolbarSet = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Set the width of the textarea
     * @param value
     *            width
     */
    public void setWidth(String value) {
        width = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Set the height of the textarea
     * @param value
     *            height
     */
    public void setHeight(String value) {
        height = value;
    }

    /**
     * @jsp.attribute required="true" rtexprvalue="true" Set the path of a
     *                custom file that can override some configurations.<br>
     *                It is recommended to use absolute paths (starting with /),
     *                like "/myfckconfig.js".
     * @param value
     *            path
     */
    public void setCustomConfigurationsPath(String value) {
        // customConfigurationsPath = value;
        try {
            this.customConfigurationsPath =
                (String) ExpressionEvaluatorManager.evaluate(
                    "customConfigurationsPath", value, String.class, this,
                    pageContext);
        } catch (JspException e) {
            e.printStackTrace();
        }
    }

    /**
     * @jsp.attribute rtexprvalue="true" Set the CSS styles file to be used in
     *                the editing area.<br>
     *                In this way you can point to a file that reflects your web
     *                site styles.
     * @param value
     *            path
     */
    public void setEditorAreaCSS(String value) {
        editorAreaCSS = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Base URL used to resolve links (on
     *                images, links, styles, etc.).<br>
     *                For example, if BaseHref is set to
     *                'http://www.fredck.com', an image that points to
     *                "/images/Logo.gif" will be interpreted by the editor as
     *                "http://www.fredck.com/images/Logo.gif", without touching
     *                the "src" attribute of the image.
     * @param value
     *            URL
     */
    public void setBaseHref(String value) {
        baseHref = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the path to the skin (graphical
     *                interface settings) to be used by the editor.
     * @param value
     *            path
     */
    public void setSkinPath(String value) {
        skinPath = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the base path used when looking
     *                for registered plugins.
     * @param value
     *            path
     */
    public void setPluginsPath(String value) {
        pluginsPath = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Enables full page editing (from
     *                &lt;HTML&gt; to &lt;/HTML&gt;).<br>
     *                It also enables the "Page Properties" toolbar button.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setFullPage(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "fullPage attribute can only be true or false");
        fullPage = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Enables the debug window to be shown
     *                when calling the FCKDebug.Output() function.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setDebug(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException("debug attribute can only be true or false");
        debug = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Tells the editor to automatically
     *                detect the user language preferences to adapt its
     *                interface language.<br>
     *                With Internet Explorer, the language configured in the
     *                Windows Control Panel is used.<br>
     *                With Firefox, the browser language is used.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setAutoDetectLanguage(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "autoDetectLanguage attribute can only be true or false: here was "
                    + value);
        autoDetectLanguage = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the default language used for the
     *                editor's interface localization.<br>
     *                The default language is used when the AutoDetectLanguage
     *                options is disabled or when the user language is not
     *                available.
     * @param value
     *            language code
     */
    public void setDefaultLanguage(String value) {
        defaultLanguage = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the direction of the editor area
     *                contents.<br>
     *                The possible values are:
     *                <ul>
     *                <li>ltr - Left to Right
     *                <li>rtl - Right to Left
     *                </ul>
     * @param value
     *            ltr/rtl
     * @throws JspException
     *             if value is not ltr or rtl
     */
    public void setContentLangDirection(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException("debug attribute can only be ltr or rtl");
        contentLangDirection = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Tells the editor to process the HTML
     *                source to XHTML on form post.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setEnableXHTML(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "enableXHTML attribute can only be true or false");
        enableXHTML = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Tells the editor to process the HTML
     *                source to XHTML when switching from WYSIWYG to Source view
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setEnableSourceXHTML(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "enableSourceXHTML attribute can only be true or false");
        enableSourceXHTML = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Block elements (like P, DIV, H1, PRE,
     *                etc...) are forced to have content (a &amp;nbsp;).<br>
     *                Empty blocks are "collapsed" by while browsing, so a empty
     *                &lt;p&gt;&lt;/p&gt; is not visible.<br>
     *                While editing, the editor "expand" empty blocks so you can
     *                insert content inside then.<br>
     *                Setting this option to "true" results useful to reflect
     *                the same output when browsing and editing.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setFillEmptyBlocks(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "fillEmptyBlocks attribute can only be true or false");
        fillEmptyBlocks = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" The HTML shown by the editor, while
     *                switching from WYSIWYG to Source views, will be processed
     *                and formatted
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setFormatSource(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "formatSource attribute can only be true or false");
        formatSource = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" The output HTML generated by the editor
     *                will be processed and formatted.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setFormatOutput(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "formatOutput attribute can only be true or false");
        formatOutput = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the characters to be used when
     *                indenting the HTML source when formatting it.<BR>
     *                Useful values are a sequence of spaces (' ') or a tab char
     *                ('\t').
     * @param value
     *            indentator
     */
    public void setFormatIndentator(String value) {
        formatIndentator = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Tells Gecko browsers to use SPAN
     *                instead of &lt;B&gt;, &lt;I&gt; and &lt;U&gt; for bold,
     *                italic an underline
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setGeckoUseSPAN(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "GeckoUseSPAN attribute can only be true or false");
        geckoUseSPAN = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Forces the editor to get the keyboard
     *                input focus on startup (page load)
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setStartupFocus(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "startupFocus attribute can only be true or false");
        startupFocus = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Converts the clipboard contents to pure
     *                text on pasting operations
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setForcePasteAsPlainText(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "forcePasteAsPlainText attribute can only be true or false");
        forcePasteAsPlainText = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Forces the ampersands (&) on tags
     *                attributes to not be converted to "&amp;amp;"<BR>
     *                This conversion is a W3C requirement for XHTML, so it is
     *                recommended to leave this option to "false".
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setForceSimpleAmpersand(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "forceSimpleAmpersand attribute can only be true or false");
        forceSimpleAmpersand = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Set the number of spaces (&amp;nbsp;)
     *                to be inserted when the user hits the "tab" key.<BR>
     *                This is an Internet Explorer only feature. Other browsers
     *                insert spaces automatically by default.
     * @param value
     *            number of spaces
     */
    public void setTabSpaces(String value) {
        tabSpaces = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Inserts a &lt;BR&gt; tag when the user
     *                hits the "enter" key, instead of starting a new paragraph
     *                (&lt;P&gt; or &lt;DIV&gt;).<BR>
     *                This is an Internet Explorer only feature. Other browsers
     *                insert the &lt;BR&gt; tag by default.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setUseBROnCarriageReturn(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "useBROnCarriageReturn attribute can only be true or false");
        useBROnCarriageReturn = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" The toolbar is Expanded on startup,
     *                otherwise it is Collapsed and the user must click on it to
     *                show it.
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setToolbarStartExpanded(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "ToolbarStartExpanded attribute can only be true or false");
        toolbarStartExpanded = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Tells the editor that the toolbar can
     *                be Collapsed/Expanded by the user when clicking the
     *                vertical bar placed on the left of it (on the right for
     *                "rtl" languages).
     * @param value
     *            true/false
     * @throws JspException
     *             if value is not true or false
     */
    public void setToolbarCanCollapse(String value) throws JspException {
        if (!value.equals("true") && !value.equals("false"))
            throw new JspException(
                "ToolbarCanCollapse attribute can only be true or false");
        toolbarCanCollapse = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the colors that must be shown in
     *                the colors panels (in the toolbar).
     * @param value
     *            colors
     */
    public void setFontColors(String value) {
        fontColors = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the list of fonts to be shown in
     *                the "Font" toolbar command.
     * @param value
     *            fonts
     */
    public void setFontNames(String value) {
        fontNames = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the list of font sizes to be shown
     *                in the "Size" toolbar command.
     * @param value
     *            sizes
     */
    public void setFontSizes(String value) {
        fontSizes = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the list of formats to be shown in
     *                the "Format" toolbar command.
     * @param value
     *            format list
     */
    public void setFontFormats(String value) {
        fontFormats = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the path to the XML file that has
     *                the definitions and rules of the styles used by the
     *                "Style" toolbar command
     * @param value
     *            path
     */
    public void setStylesXmlPath(String value) {
        stylesXmlPath = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the page called when
     *                the user clicks the "Browse Server" button in the "Link"
     *                dialog window.<BR>
     *                In this way, you can create your custom File Browser that
     *                is well integrated with your system.
     * @param value
     *            path
     */
    public void setLinkBrowserURL(String value) {
        linkBrowserURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the page called when
     *                the user clicks the "Browse Server" button in the "Image"
     *                dialog window.<BR>
     *                In this way, you can create your custom Image Browser that
     *                is well integrated with your system.
     * @param value
     *            path
     */
    public void setImageBrowserURL(String value) {
        imageBrowserURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the page called when
     *                the user clicks the "Browse Server" button in the "Flash"
     *                dialog window.<BR>
     *                In this way, you can create your custom Flash Browser that
     *                is well integrated with your system.
     * @param value
     *            path
     */
    public void setFlashBrowserURL(String value) {
        flashBrowserURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the upload handler
     *                called when the user clicks the "Send it to server" button
     *                in the "Link" dialog window.<BR>
     *                In this way, you can create your custom Link Uploader that
     *                is well integrated with your system.
     * @param value
     *            path
     */
    public void setLinkUploadURL(String value) {
        linkUploadURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the upload handler
     *                called when the user clicks the "Send it to server" button
     *                in the "Image" dialog window.<BR>
     *                In this way, you can create your custom Image Uploader
     *                that is well integrated with your system.
     * @param value
     *            path
     */
    public void setImageUploadURL(String value) {
        imageUploadURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true" Sets the URL of the upload handler
     *                called when the user clicks the "Send it to server" button
     *                in the "Flash" dialog window.<BR>
     *                In this way, you can create your custom Flash Uploader
     *                that is well integrated with your system.
     * @param value
     *            path
     */
    public void setFlashUploadURL(String value) {
        flashUploadURL = value;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableFlashBrowser
     */
    public void setEnableFlashBrowser(String enableFlashBrowser) {
        this.enableFlashBrowser = enableFlashBrowser;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableFlashUpload
     */
    public void setEnableFlashUpload(String enableFlashUpload) {
        this.enableFlashUpload = enableFlashUpload;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableImageBrowser
     */
    public void setEnableImageBrowser(String enableImageBrowser) {
        this.enableImageBrowser = enableImageBrowser;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableImageUpload
     */
    public void setEnableImageUpload(String enableImageUpload) {
        this.enableImageUpload = enableImageUpload;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableLinkBrowser
     */
    public void setEnableLinkBrowser(String enableLinkBrowser) {
        this.enableLinkBrowser = enableLinkBrowser;
    }

    /**
     * @jsp.attribute rtexprvalue="true"
     * @param enableLinkUpload
     */
    public void setEnableLinkUpload(String enableLinkUpload) {
        this.enableLinkUpload = enableLinkUpload;
    }

    /**
     * @jsp.attribute required="false" rtexprvalue="true" Set the unique id of
     *                the editor
     * @param value
     *            name
     */
    public void setUuid(String value) {
        // this.uuid = uuid;
        try {
            this.uuid =
                (String) ExpressionEvaluatorManager.evaluate("uuid", value,
                    String.class, this, pageContext);
        } catch (JspException e) {
            e.printStackTrace();
            this.uuid = "";
        }
    }

    /**
     * Initialize the FCKEditor container and set attributes
     * 
     * @return EVAL_BODY_BUFFERED
     */
    public int doStartTag() throws JspException {
        fcked =
            new FCKEditor((HttpServletRequest) pageContext.getRequest(), id);
        if (uuid != null)
            fcked.setUuid(uuid);
        if (toolbarSet != null)
            fcked.setToolbarSet(toolbarSet);
        if (basePath != null)
            fcked.setBasePath(basePath);
        if (width != null)
            fcked.setWidth(width);
        if (height != null)
            fcked.setHeight(height);
        if (customConfigurationsPath != null)
            fcked.getConfig().put("CustomConfigurationsPath",
                customConfigurationsPath);
        if (editorAreaCSS != null)
            fcked.getConfig().put("EditorAreaCSS", editorAreaCSS);
        if (baseHref != null)
            fcked.getConfig().put("BaseHref", baseHref);
        if (skinPath != null)
            fcked.getConfig().put("SkinPath", skinPath);
        if (pluginsPath != null)
            fcked.getConfig().put("PluginsPath", pluginsPath);
        if (fullPage != null)
            fcked.getConfig().put("FullPage", fullPage);
        if (debug != null)
            fcked.getConfig().put("Debug", debug);
        if (autoDetectLanguage != null)
            fcked.getConfig().put("AutoDetectLanguage", autoDetectLanguage);
        if (defaultLanguage != null)
            fcked.getConfig().put("DefaultLanguage", defaultLanguage);
        if (contentLangDirection != null)
            fcked.getConfig().put("ContentLangDirection", contentLangDirection);
        if (enableXHTML != null)
            fcked.getConfig().put("EnableXHTML", enableXHTML);
        if (enableSourceXHTML != null)
            fcked.getConfig().put("EnableSourceXHTML", enableSourceXHTML);
        if (fillEmptyBlocks != null)
            fcked.getConfig().put("FillEmptyBlocks", fillEmptyBlocks);
        if (formatSource != null)
            fcked.getConfig().put("FormatSource", formatSource);
        if (formatOutput != null)
            fcked.getConfig().put("FormatOutput", formatOutput);
        if (formatIndentator != null)
            fcked.getConfig().put("FormatIndentator", formatIndentator);
        if (geckoUseSPAN != null)
            fcked.getConfig().put("GeckoUseSPAN", geckoUseSPAN);
        if (startupFocus != null)
            fcked.getConfig().put("StartupFocus", startupFocus);
        if (forcePasteAsPlainText != null)
            fcked.getConfig().put("ForcePasteAsPlainText",
                forcePasteAsPlainText);
        if (forceSimpleAmpersand != null)
            fcked.getConfig().put("ForceSimpleAmpersand", forceSimpleAmpersand);
        if (tabSpaces != null)
            fcked.getConfig().put("TabSpaces", tabSpaces);
        if (useBROnCarriageReturn != null)
            fcked.getConfig().put("UseBROnCarriageReturn",
                useBROnCarriageReturn);
        if (toolbarStartExpanded != null)
            fcked.getConfig().put("ToolbarStartExpanded", toolbarStartExpanded);
        if (toolbarCanCollapse != null)
            fcked.getConfig().put("ToolbarCanCollapse", toolbarCanCollapse);
        if (fontColors != null)
            fcked.getConfig().put("FontColors", fontColors);
        if (fontNames != null)
            fcked.getConfig().put("FontNames", fontNames);
        if (fontSizes != null)
            fcked.getConfig().put("FontSizes", fontSizes);
        if (fontFormats != null)
            fcked.getConfig().put("FontFormats", fontFormats);
        if (stylesXmlPath != null)
            fcked.getConfig().put("StylesXmlPath", stylesXmlPath);
        if (linkBrowserURL != null)
            fcked.getConfig().put("LinkBrowserURL", linkBrowserURL);
        if (imageBrowserURL != null)
            fcked.getConfig().put("ImageBrowserURL", imageBrowserURL);
        if (flashBrowserURL != null)
            fcked.getConfig().put("FlashBrowserURL", flashBrowserURL);
        if (linkUploadURL != null)
            fcked.getConfig().put("LinkUploadURL", linkUploadURL);
        if (imageUploadURL != null)
            fcked.getConfig().put("ImageUploadURL", imageUploadURL);
        if (flashUploadURL != null)
            fcked.getConfig().put("FlashUploadURL", flashUploadURL);
        return EVAL_BODY_BUFFERED;
    }

    /**
     * Retrive initial value to be edited and writes the HTML code in the page
     * 
     * @return SKIP_BODY
     * @throws JspException
     *             if an error occurs while writing to the out buffer
     */
    public int doAfterBody() throws JspException {
        BodyContent body = getBodyContent();
        JspWriter writer = body.getEnclosingWriter();
        String bodyString = body.getString();
        fcked.setValue(bodyString);
        try {
            writer.println(fcked.create());
        } catch (IOException ioe) {
            throw new JspException(
                "Error: IOException while writing to the user");
        }
        return SKIP_BODY;
    }
}